<script>
	function delF(){
		var frm = document.forms["myForm"];
		frm.action = "<?=site_url()?>payment/delete";
		frm.submit();
	}
</script>
<div id="mainContent">
<form  name="myForm" id="myForm" method="post" action="<?=site_url()?>payment/approve">
<input type="hidden" name="txtID" id="txtID" />

<table width="1000px" border="0" cellspacing="0" cellpadding="0" align="center" >
	<tr align="center">
    	<td> <h2>รายการโอนเงิน </h2><hr/> 
    	</td>
    </tr>
	<tr style="height:10px;">
    	<td>&nbsp;</td>
    </tr>
    <tr >
    	<td><div align="center">
    	  <input name="Submit" type="submit" value="คอนเฟิร์มการโอนเงิน" />
    	  <input name="Submit2" type="submit" value="ลบข้อมูล" onclick="delF();" />
  	  </div></td>
    </tr>
    <tr style="height:10px;">
    	<td></td>
    </tr>
	<tr>
		<td align="center">          
          <div align="left"></div>
          		<?php $nRow = 1; ?>
                <table width="980px" border="0" cellspacing="2px" cellpadding="0">                 
                  <tr>                    
                    <td align="left"><table width="100%" border="0" cellspacing="2px" cellpadding="0">
                      
                      <tr bgcolor="#000099">
                        <td width="30px">&nbsp;</td>
                        <td width="150px"><div align="center" style="color:#FFFFFF; font-weight:bold;">วันที่และเวลาโอนเงิน</div></td>
                        <td width="80px"><div align="center" style="color:#FFFFFF; font-weight:bold;">จำนวนเงิน</div></td>
                        <td width="220px"><div align="center" style="color:#FFFFFF; font-weight:bold;">ชื่อผู้โอน</div></td>
                        <td width="70px"><div align="center" style="color:#FFFFFF; font-weight:bold;">สถานภาพ</div></td>
                        <td width="140px"><div align="center" style="color:#FFFFFF; font-weight:bold;">โอนเข้าบัญชี</div></td>
                        <td><div align="center" style="color:#FFFFFF; font-weight:bold;">วิชา/ค่าใช้จ่าย</div></td>
                        <td><div align="center" style="color:#FFFFFF; font-weight:bold;">ส่งคอนเฟิร์ม</div></td>
                        <td width="80px"><div align="center" style="color:#FFFFFF; font-weight:bold;">รายละเอียด  </div></td>
                      </tr>
                      <?php $monthTh = array("","ม.ค.","ก.พ. ","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
                      		$i = 0;
							foreach ($trans as $row) {
								if($i % 2 == 0) {
					 				echo '<tr align="center">';
					 			} else {
					 				echo '<tr align="center" bgcolor="#C6E2FF">'; 
					 			}
					 			$i++;
 			
		                        echo '<td><input type="checkbox" name="txtDel[]" value="'. $row->payment_id .'"/></td>';
		                        echo '<td>';
		                        
		                        echo strftime("%d",strtotime($row->transfer_date_str)) . ' ' . $monthTh[ (int) strftime("%m",strtotime($row->transfer_date_str))] . ' ' .$row->transfer_hr . ":" . $row->transfer_min;
		                        echo '  </td>';
		                        echo '<td>'. $row->amount .'</td>';
		                        echo '<td>'. $row->first_name . ' ' . $row->last_name .'</td>';
		                        echo '<td>'. $row->status .'</td>';
		                        echo '<td>'. $row->account_no .'</td>';
		                        echo '<td>';
		                        if($row->pay_detail)
		                        	echo $row->pay_detail;
		                        else 
		                        	echo $row->pay_subject;
		                        echo '</td>';
		                        echo '<td>';
		                        if($row->admin_appreve)
		                        	echo 'ส่งแล้ว';
		                        else 
		                        	echo 'ยังไม่ได้ส่ง';
		                        echo '</td>';
		                        echo '<td><a href="'  . site_url() . 'payment/detail/'. $row->payment_id .'" > 
		                              <div align="center"> <img border="0" src="'. base_url() .'images/detail_b.png" onmouseout="toBlack(this);" onmouseover="toColor(this);" width="25" height="25" /> </a></div>	</td>';	
		                        echo '</tr>';
							}
                      ?>
                    </table></td>
                  </tr>
                  <tr style="height: 10px;">
                    <td align="right"></td>
                    <td align="left"></td>
                  </tr>
              </table>
          
		</td>
	</tr>
         
    <tr style="height:10px;">
    	<td></td>
    </tr>
    <tr>
    	<td align="center"><?php echo $paging;?></td>
    </tr>
    <tr style="height:10px;">
    	<td></td>
    </tr>
</table>
</form>
</div>
<script type="text/javascript">
function toBlack(obj) {
	obj.src = '<?=base_url()?>images/detail_b.png';
}
function toColor(obj) {
	obj.src = '<?=base_url()?>images/detail.png';
}
</script>